/*
 * File:   Result.cpp
 * Author: jd219546
 *
 * Created on 18 octobre 2011, 14:55
 */

#include "Result.h"
#include <iostream>

using namespace std;

Result::Result():x0(0),y0(0),x1(0),y1(0),sum(0) {
}

void Result::display() const
{
	cout << x0 << " " << y0 << " " << x1 << " " << y1;
	#if DISPLAY
	cout << " | " << sum << endl;
	#else
	cout << endl;
	#endif
}

// use s_rect ?
/*
void Result::display() const
{
   cout << r_maxsubarray.x0 << " " << r_maxsubarray.y0 << " " << r_maxsubarray.x1 << " " << r_maxsubarray.y1 << " | " << sum << endl;;
}
*/
/*
void Result::update(Result & result, t_int x0, t_int y0, t_int x1, t_int y1, t_int sum)
{
    result.x0 = x0;
    result.y0 = y0;
    result.x1 = x1;
    result.y1 = y1;
    result.sum = sum;
}
*/
void Result::update_y0_sum(t_int y0, t_int sum)
{
	this->y0 = y0;
	this->sum = sum;
}
void Result::update_y1_sum(t_int y1, t_int sum)
{
	this->y1 = y1;
	this->sum = sum;
}
void Result::update_x0_y0_x1_sum(t_int x0, t_int y0, t_int x1, t_int sum)
{
	this->x0 = x0;
	this->y0 = y0;
	this->x1 = x1;
	this->sum = sum;
}

void Result::update_x0_x1_y1_sum(t_int x0, t_int x1, t_int y1, t_int sum)
{
	this->x0 = x0;
	this->x1 = x1;
	this->y1 = y1;
	this->sum = sum;
}

bool Result::operator<(const Result & result) const
{
	return this->sum < result.sum;
}
bool Result::operator>(const Result & result) const
{
	return this->sum > result.sum;
}

void Result::update_x0_sum(t_int x0, t_int sum)
{
	this->x0 = x0;
	this->sum = sum;
}
void Result::update_x1_sum(t_int x1, t_int sum)
{
	this->x1 = x1;
	this->sum = sum;
}
void Result::update_x0_y0_y1_sum(t_int x0, t_int y0, t_int y1, t_int sum)
{
	this->x0 = x0;
	this->y0 = y0;
	this->y1 = y1;
	this->sum = sum;
}
void Result::update_y0_x1_y1_sum(const t_int & y0, const t_int& x1, const t_int & y1, const t_int &sum)
{
	this->x1= x1;
	this->y0 = y0;
	this->y1 = y1;
	this->sum = sum;
}

Result::~Result() {
}

